A terminal having a built-in imaging apparatus may employ a contrast-detection autofocus mode during photographing. In the contrast-detection autofocus mode, focusing is performed by calculating a focus value (FV). When the focus value reaches a peak value, a position of a lens in the imaging apparatus is a second position. However, the imaging apparatus may be out of focus when a jitter occurs on the terminal.